﻿
@{
    ViewBag.Title = "Register";
    Layout = "~/Views/shard/_layout.cshtml";
}
<div class="headertwo clearfloat" id="header">
    <a href="javascript:history.go(-1)" class="fl box-s"><i class="iconfont icon-arrow-l fl"></i></a>
    <p class="fl">用户注册</p>
</div>
<form id="formData">
<div class="register clearfloat" id="main">
    <ul>
        <li class="clearfloat">
            <p class="tit fl">手机号</p>
            <input type="text" id="shouji" name="Phone" value="" class="shuru fl" placeholder="请输入手机号码" />
        </li>
        <li class="clearfloat">
            <p class="tit fl">验证码</p>
            <input type="text" id="" name="PhoneYan" value="" class="shuru shurutwo fl" placeholder="请输入短信验证码" />
            <a href="#loginmodalt" id="modaltrigger">
                <input type="button" id="" value="获取短信验证码" class="btn fr" />
            </a>
        </li>
        <li class="clearfloat">
            <p class="tit fl">密码</p>
            <input type="text" id="" name="Pass" value="" class="shuru fl" placeholder="请设置密码" />
        </li>
        <li class="clearfloat">
            <p class="tit fl">确认密码</p>
            <input type="text" id="" value="" name="QuePass" class="shuru fl" placeholder="请再次输入密码" />
        </li>
    </ul>
    <a id="zhuce" class="pay-btn clearfloat">
        注册
    </a>
    <div class="bottom clearfloat">
        <p class="fl">
            已有账号？
            <a href="register.html">立即登录</a>
        </p>
    </div>
</div>
</form>
<!--弹窗内容 star-->
<div id="loginmodalt" class="box-s loginmodaltwo" style="display:none;">
    <div class="top clearfloat box-s">
        <p class="tit">请输入图片验证码</p>
        <div class="xia clearfloat">
            <input type="text" id="maer" value="" class="yzm fl" placeholder="填写图片验证码" />
            <img id="yanzhengma" src="/Main/CreateYan" />
        </div>
    </div>
    <form id="loginform" name="loginform" method="post" action="">
        <div class="center fl"><input type="submit" name="loginbtn" id="quxiaoBtn" class="hidemodal" value="取消" tabindex="3"></div>
        <div class="center fl"><input type="submit" name="loginbtn" id="sendBtn" class="hidemodal" value="确定" tabindex="3"></div>
    </form>
</div>
@section footerjs{
    <script type="text/javascript" src="~/js/jquery.leanModal.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#loginform').submit(function (e) {
                return false;
            });
            //弹出层调用语句
            $('#modaltrigger').leanModal({
                top: 110,
                overlay: 0.45,
                closeButton: ".hidemodal"
            }).click(function () {
                $('#yanzhengma').click();
            });
        });
        //验证码更新
        $('#yanzhengma').click(function () {
            $(this).attr('src', '/Main/CreateYan?ssssss=' + Math.random());
        });

        $('#quxiaoBtn').click(function () {
            $("#lean_overlay").fadeOut(200);
            $('#loginmodalt').css({ "display": "none" })
        });

        $('#sendBtn').click(function () {
            var ma = $('#maer').val();
            var shouji = $('#shouji').val();
            $.ajax({
                url: '/Main/SendDuanXin',
                data: { yan: ma, shou: shouji },
                dataType: 'json',
                type: 'post',
                success: function (res) {
                    if (res.status == 'ok') {
                        $("#lean_overlay").fadeOut(200);
                        $('#loginmodalt').css({ "display": "none" })
                    } else {
                        alert('验证码错误');
                        $('#maer').val('')
                        $('#yanzhengma').click();
                    }
                },
                error: function () {
                    alert("网络请求错误");
                }
            })
        })
        $('#zhuce').click(function () {
            var formData = $('#formData').serializeArray();
            $.ajax({
                url: '/Main/Reister',
                data: formData,
                dataType: 'json',
                type: 'post',
                success: function (res) {
                    if (res.status == 'ok') {
                        alert("注册成功");
                    } else {
                        alert('验证码错误');
                    }
                },
                error: function () {
                    alert("网络请求错误");
                }
            })
        })

    </script>
}
